package com.lvhengchang.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lvhengchang.mapper.CardMapper;
import com.lvhengchang.pojo.Card;
import com.lvhengchang.service.CardService;

@Service
public class CardServiceImpl implements CardService {

	@Autowired
	private CardMapper cardMapper;

	@Override
	public List<Card> selectCardList() {
		return cardMapper.selectCardList();
	}

	@Override
	public int deleteCard(int id) {
		return cardMapper.deleteCard(id);
	}

	@Override
	public int deleteCardByBelong(int belong) {
		return cardMapper.deleteCardByBelong(belong);
	}

	@Override
	public int insertCard(Card card) throws Exception {
		int r = cardMapper.insertCard(card);
		if (r != 0) {
			return r;
		}
		throw new RuntimeException("银行卡添加异常");
	}

	@Override
	public int updateById(Card card) {
		return cardMapper.updateCard(card);
	}

	@Override
	public Card getCardById(int id) {
		return cardMapper.selectByCardId(id);
	}

}
